package Book;

import java.util.Objects;

/**
 * @Author YuanYuan
 * @Date 2022/5/18
 * @Time 9:54
 */
public class Book {
    private String name;
    private String writer;
    private double price;
    private boolean isborrow;

    public Book(String name, String writer, double price) {
        this.name = name;
        this.writer = writer;
        this.price = price;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", writer='" + writer + '\'' +
                ", price=" + price +'\'' +
                (isborrow?",以借出":",未借出")+
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWriter() {
        return writer;
    }

    public void setWriter(String writer) {
        this.writer = writer;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public boolean isIsborrow() {
        return isborrow;
    }

    public void setIsborrow(boolean isborrow) {
        this.isborrow = isborrow;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Book book = (Book) o;
        return Objects.equals(name,book.name);
    }

}
